-
-
Notifications
You must be signed in to change notification settings - Fork 521
WP/GetMetaSingle: simplify code using two class constants #2631
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
WP/GetMetaSingle: simplify code using two class constants #2631
Conversation
00496d4
to
2d204ca
Compare
Now that support for PHP < 7.2 has been dropped in PR 2614, we can simplify the sniff code by defining the two different function signature formats as class constants. This was not possible before as PHP < 5.6 did not support defining class constants as arrays.
2d204ca
to
e331fe6
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just left one comment about the since tag.
2f9ae1b
to
a09975d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @rodrigoprimo !
Only remark I have left is that as support for PHP < 7.2 has been dropped, these new class constants could be defined with visibility and in this case, I'd recommend private
visibility as the info is only relevant to this sniff.
Not a blocker though, as the pre-existing constants don't have visibility modifiers yet, so I expect that to be changed in a future PR anyway.
Only thing to remember about this is that the pre-existing constants must be declared as public
and the visibility can't be changed until WPCS 4.0, while for new class constants like these, we can use the correct visibility from the get-go.
Thanks, @jrfnl! Defining the visibility of the two new constants to Sorry @dingo-d for pushing the change right after you submitted another review for this PR. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @rodrigoprimo ! All good from me.
Description
Now that support for PHP < 7.2 has been dropped in PR #2614, we can simplify the sniff code by defining the two different function signature formats as class constants. This was not possible before, as PHP < 5.6 did not support defining class constants as arrays.
Suggested changelog entry
N/A